package com.doit.demo01;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;


public class UDPReceive {
    public static void main(String[] args) throws IOException {
        while (true) {
            DatagramSocket receiveSpcket = new DatagramSocket(38250);
            byte[] bytes = new byte[1024];
            DatagramPacket dp = new DatagramPacket(bytes, bytes.length);
            receiveSpcket.receive(dp);
            byte[] data = dp.getData();
            int length = dp.getLength();
            System.out.println(new String(data, 0, length));
            receiveSpcket.close();
        }
    }
}
